/*
struct ListNode {
	int val;
	struct ListNode *next;
	ListNode(int x) :
			val(x), next(NULL) {
	}
};*/
class Solution {
public:
    ListNode* FindFirstCommonNode( ListNode* p1, ListNode* p2) {
        ListNode* node1 = p1;
        ListNode* node2 = p2;
        if(!p1 || !p2) return nullptr;
        while(node1!=node2) {
            node1 = node1==nullptr ? p2 : node1->next;
            node2 = node2==nullptr ? p1 : node2->next;
        }    
        return node1;
    }
};